//package com.kuangstudy.config;
//
//import com.google.gson.GsonBuilder;
//import com.google.gson.LongSerializationPolicy;
//import org.springframework.boot.autoconfigure.http.HttpMessageConverters;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.http.converter.HttpMessageConverter;
//import org.springframework.http.converter.json.GsonHttpMessageConverter;
//
//import java.nio.charset.Charset;
//import java.util.ArrayList;
//import java.util.Collection;
//
//@Configuration
//public class GsonConfiguration {
//
//    @Bean
//    public HttpMessageConverters customConverters() {
//        Collection<HttpMessageConverter<?>> messageConverters = new ArrayList<>();
//        GsonHttpMessageConverter gsonHttpMessageConverter = new GsonHttpMessageConverter();
//        gsonHttpMessageConverter.setDefaultCharset(Charset.defaultCharset());
//        GsonBuilder gsonBuilder = new GsonBuilder();
//        gsonBuilder.setDateFormat("yyyy-MM-dd HH:mm:ss");
//        gsonBuilder.setLongSerializationPolicy(LongSerializationPolicy.STRING);
//        gsonHttpMessageConverter.setGson(gsonBuilder.serializeNulls().create());
//        messageConverters.add(gsonHttpMessageConverter);
//        return new HttpMessageConverters(true, messageConverters);
//    }
//}
//
